***** MAIN RESULT for Table 9


run essentials_Table_9.do


	* Table 9						
	{
	* For log_loan_val
		local regnum = 1
		
		* Double interactions for high-income
		eststo r`regnum': reghdfe log_loan_val interaction_post_share post demeaned_share_treated if time<=225 & time != 218 & low_income == 1, absorb(i.lacode_float i.time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_l "Yes": r`regnum'
			quietly estadd local fixed_t "Yes": r`regnum'
			local regnum = `regnum' + 1	
		* Double interactions for low-income
		eststo r`regnum': reghdfe log_loan_val interaction_post_share post demeaned_share_treated if time<=225 & time != 218 & low_income == 0, absorb(i.lacode_float i.time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_l "Yes": r`regnum'
			quietly estadd local fixed_t "Yes": r`regnum'									
			local regnum = `regnum' + 1	
		eststo r`regnum': reghdfe log_loan_val post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.lacode_float i.time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_l "Yes": r`regnum'
			quietly estadd local fixed_t "Yes": r`regnum'
			local regnum = `regnum' + 1	
		eststo r`regnum': reghdfe log_loan_val post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.la_time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_lt "Yes": r`regnum'
			local regnum = `regnum' + 1		
		eststo r`regnum': reghdfe log_loan_val post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.la_time i.la_lowinc) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_lt "Yes": r`regnum'
			quietly estadd local fixed_li "Yes": r`regnum'
			local regnum = `regnum' + 1	
		eststo r`regnum': reghdfe log_loan_val post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.la_time i.la_lowinc i.lowinc_time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_lt "Yes": r`regnum'
			quietly estadd local fixed_li "Yes": r`regnum'
			quietly estadd local fixed_ti "Yes": r`regnum'
			local regnum = `regnum' + 1								
		

	* For log_tot_num
		// NOTE: regnum not set to 1
		eststo r`regnum': reghdfe log_tot_num interaction_post_share post demeaned_share_treated if time<=225 & time != 218 & low_income == 1, absorb(i.lacode_float i.time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_l "Yes": r`regnum'
			quietly estadd local fixed_t "Yes": r`regnum'
			local regnum = `regnum' + 1	
		* Double interactions for low-income
		eststo r`regnum': reghdfe log_tot_num interaction_post_share post demeaned_share_treated if time<=225 & time != 218 & low_income == 0, absorb(i.lacode_float i.time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_l "Yes": r`regnum'
			quietly estadd local fixed_t "Yes": r`regnum'									
			local regnum = `regnum' + 1	
		eststo r`regnum': reghdfe log_tot_num post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.lacode_float i.time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_l "Yes": r`regnum'
			quietly estadd local fixed_t "Yes": r`regnum'
			local regnum = `regnum' + 1	
		eststo r`regnum': reghdfe log_tot_num post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.la_time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_lt "Yes": r`regnum'
			local regnum = `regnum' + 1		
		eststo r`regnum': reghdfe log_tot_num post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.la_time i.la_lowinc) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_lt "Yes": r`regnum'
			quietly estadd local fixed_li "Yes": r`regnum'
			local regnum = `regnum' + 1	
		eststo r`regnum': reghdfe log_tot_num post_share_lowinc interaction_post_share interaction_post_inc interaction_inc_share post low_income demeaned_share_treated if time<=225 & time != 218, absorb(i.la_time i.la_lowinc i.lowinc_time) vce(cluster lacode_float_3)
			quietly estadd local la_int "-": r`regnum'
			quietly estadd local fixed_lt "Yes": r`regnum'
			quietly estadd local fixed_li "Yes": r`regnum'
			quietly estadd local fixed_ti "Yes": r`regnum'
			local regnum = `regnum' + 1	
		
		
		
		#delimit ;
		esttab r1 r2 r3 r4 r5 r6 using table_9.tex, label replace nonotes se keep( post_share_lowinc interaction_post_share) booktabs 
		s(N r2 la_int fixed_l fixed_t fixed_lt fixed_li fixed_ti, label("Observations" "\(R^{2}\)" "Lower-level interactions" "Local area FE" "Time FE" "Local area\$\times\$Time FE" "Local area\$\times\$Income quint. FE" "Time\$\times\$Income quint. FE")) 
		nomtitles mgroups("\$\leftarrow\log (\pounds \mbox{ of loans})\rightarrow\$" "\$\leftarrow\log (\#  \mbox{ of loans})\rightarrow\$", pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) lhs("Variable"));
		#delimit cr
		
		#delimit ;
		esttab r7 r8 r9 r10 r11 r12 using app_table_A14.tex, label replace nonotes se keep( post_share_lowinc interaction_post_share) booktabs 
		s(N r2 la_int fixed_l fixed_t fixed_lt fixed_li fixed_ti, label("Observations" "\(R^{2}\)" "Lower-level interactions" "Local area FE" "Time FE" "Local area\$\times\$Time FE" "Local area\$\times\$Income quint. FE" "Time\$\times\$Income quint. FE")) 
		nomtitles mgroups("\$\leftarrow\log (\mbox{Number of loans})\rightarrow\$" "\$\leftarrow\log (\#  \mbox{ of loans})\rightarrow\$", pattern(1 0 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) lhs("Variable"));
		#delimit cr
		
		
		
		* clear estimates for next regression
		eststo clear
	}
							

		
